package com.tester.yaa.exam001.phone;

import com.tester.yaa.exam001.phone.server.IPhone;
import com.tester.yaa.exam001.phone.server.Phone;
import com.tester.yaa.exam001.phone.server.VivoPhone;

/**
 * @Aduthor yinanan
 * @ClassName PhoneFactory
 * @Date 2022/12/4 19:54
 * @Description 手机加工工厂
 **/
public class PhoneFactory {
    
    /** 
    * @Description: //根据名称建造（载入）对应的手机（类）
    * @author: yinanan
    * @Param: [phoneType]
    * @return: com.tester.hgc.yinanan.phone.server.Phone
    * @Date: 2022/12/4
    */ 
    public Phone machiningPhone(String phoneType) {
        if (phoneType.equalsIgnoreCase("VivoPhone")) {
            return new VivoPhone();
        } else if (phoneType.equalsIgnoreCase("IPhone")) {
            return new IPhone();
        }
        return null;
    }

    //执行
    public static void main(String[] args) {
        PhoneFactory ph = new PhoneFactory();
        ph.machiningPhone("VivoPhone");
        ph.machiningPhone("IPhone");
    }
}